package com.czl.module_service.fragment

import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.czl.base.config.AppConstants
import com.czl.base.route.RouteCenter
import com.czl.base.base.BaseTabFragment
import com.czl.base.base.BaseTabViewModel
import com.czl.base.databinding.FragmentBaseTabBinding
import me.yokeyword.fragmentation.SupportFragment

@Route(path = AppConstants.Router.Service.F_HOUSES_PAYMENT)
class HousesPaymentFragment : BaseTabFragment<FragmentBaseTabBinding, BaseTabViewModel>() {
    override fun initData() {
        super.initData()
        viewModel.tabData.set("待缴费用, 已缴费用")
        viewModel.tvTitle.set("物业缴费")
    }

    /*override fun initViewObservable() {
        super.initViewObservable()
        LiveBusCenter.observePayResultEvent(this, {
            when (it.payType) {
                AppConstants.Constants.PAY_SUCCESS_TYPE -> {
                    binding.viewPager.currentItem = 1
                    LiveBusCenter.postPayResultReturnEvent(it.payType)
                }
                AppConstants.Constants.PAY_FAIL_TYPE -> {
                    binding.viewPager.currentItem = 0
                    LiveBusCenter.postPayResultReturnEvent(it.payType)
                }
            }
        })
    }*/

    override fun fragments(): List<SupportFragment> {
        return arrayListOf(
            RouteCenter.navigate(AppConstants.Router.Service.F_HOUSES_PAYMENT_LIST_FRAGMENT, Bundle().apply {
                putSerializable(AppConstants.BundleKey.PAY_TAB_INDEX, 1)
            }) as SupportFragment,

            RouteCenter.navigate(AppConstants.Router.Service.F_HOUSES_PAYMENT_LIST_FRAGMENT, Bundle().apply {
                putSerializable(AppConstants.BundleKey.PAY_TAB_INDEX, 2)
            }) as SupportFragment
        )
    }

    override fun useBaseLayout(): Boolean {
        return true
    }

}